package com.hk.webapp.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

import com.hk.webapp.bean.Test;
import com.hk.webapp.dao.TestMapper;
import com.hk.webapp.service.TestService;
import com.hk.webapp.vo.PageVo;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

@Service
@Transactional(readOnly = true, rollbackFor = Exception.class)
public class TestServiceImpl  implements TestService {


    @Resource
    private TestMapper  testMapper;


    @Override
    public List<Test> GetList() {


        return  testMapper.GetList();
    }

    @Override
    public Test GetDetail(Integer id) {
        return testMapper.GetDetail(id);
    }

    @Override
    public PageInfo<Test> getPageList(PageVo pageVo) {
       /* PageHelper.startPage(vo.getPageIndex(),vo.getPageSize());
        List<SysUser> list=sysUserMapper.getPageList();
        PageInfo<SysUser> plist=new PageInfo<>(list);
        return plist;*/

       PageHelper.startPage(pageVo.getPageIndex(),pageVo.getPageSize());
       List<Test>list=testMapper.getPageList();
       PageInfo<Test>plist= new PageInfo<>(list);
       return   plist;
    }

    @Override
    @Transactional
    public int Insert(Test test) {
       return   testMapper.insert(test);
    }

    @Override
    @Transactional
    public int Del(Integer id) {
       return     testMapper.del(id);
    }
    @Override
    @Transactional
    public  int updateById(Test test)
    {
        return   testMapper.updateById(test);
    }
}
